package com.piz.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;


@Entity
@Table(name="order_txn")
public class Ordertxn  implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Long id;
	private Double totalAmt;
	private Double discountAmt;
	private Long status;
	private Long bankDetails;
	private Long user;
	private Date txnDate;
	private Long bpoId;
	private Long discountCoupon;
	private Ship_Addr shipAddr;
	private Long paymentType;
	private List<OrderDetails> orderItem;
	
	/**
	 *  Auto-generated constructor stub
	 */
	public Ordertxn() {
		
		// Auto-generated constructor stub
	}
	
	/**
	 * @param totalAmt
	 * @param discountAmt
	 * @param status
	 * @param bankDetails
	 * @param user
	 * @param txnDate
	 * @param discountCoupon
	 * @param shipAddr
	 * @param paymentType
	 */
	public Ordertxn(Double totalAmt, Double discountAmt,Long status, Long bankDetails, 
			Long user, Date txnDate, Long bpoId, Long discountCoupon, Ship_Addr shipAddr, Long paymentType) {
		
		this.totalAmt = totalAmt;
		this.discountAmt = discountAmt;
		this.status = status;
		this.bankDetails = bankDetails;
		this.user = user;
		this.txnDate = txnDate;
		this.bpoId = bpoId;
		this.discountCoupon = discountCoupon;
		this.shipAddr = shipAddr;
		this.paymentType = paymentType;
	}

	@Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
	@Column(name="id")
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name="total_amt")
	public Double getTotalAmt() {
		return totalAmt;
	}

	public void setTotalAmt(Double totalAmt) {
		this.totalAmt = totalAmt;
	}
	
	@Column(name="discountAmt")
	public Double getDiscountAmt() {
		return discountAmt;
	}

	public void setDiscountAmt(Double discountAmt) {
		this.discountAmt = discountAmt;
	}
	
	@Column(name="status")
	public Long getStatus() {
		return status;
	}

	public void setStatus(Long status) {
		this.status = status;
	}
	
	@Column(name="bank_details")
	public Long getBankDetails() {
		return bankDetails;
	}

	public void setBankDetails(Long bankDetails) {
		this.bankDetails = bankDetails;
	}
	
	@Column(name="user")
	public Long getUser() {
		return user;
	}

	public void setUser(Long user) {
		this.user = user;
	}
	
	@Column(name="txnDate")
	public Date getTxnDate() {
		return txnDate;
	}

	public void setTxnDate(Date txnDate) {
		this.txnDate = txnDate;
	}
	
	@Column(name="bpo")
	public Long getBpoId() {
		return bpoId;
	}

	public void setBpoId(Long bpoId) {
		this.bpoId = bpoId;
	}
	
	@Column(name="discountCoupon")
	public Long getDiscountCoupon() {
		return discountCoupon;
	}

	public void setDiscountCoupon(Long discountCoupon) {
		this.discountCoupon = discountCoupon;
	}
	
	@OneToOne(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
	public Ship_Addr getShipAddr() {
		return shipAddr;
	}

	public void setShipAddr(Ship_Addr shipAddr) {
		this.shipAddr = shipAddr;
	}
	
	@Column(name="paymentType")
	public Long getPaymentType() {
		return paymentType;
	}

	public void setPaymentType(Long paymentType) {
		this.paymentType = paymentType;
	}

	/**
	 * @return the List<Order_Details> orderItem
	 */
	@OneToMany(cascade={CascadeType.ALL},fetch = FetchType.EAGER)
	@JoinColumn(name="order_id")
	public List<OrderDetails> getOrderItem() {
		return orderItem;
	}

	/**
	 * @param orderItem List<Order_Details> the orderItem to set
	 */
	public void setOrderItem(List<OrderDetails> orderItem) {
		this.orderItem = orderItem;
	}

	
	
}
